﻿using SafoverWpfFw;
using System;
using System.Globalization;
using Safover.Lidar.DataContract;

namespace Safover.LidarCollector.Converter
{
    public class LidarWorkModeToAliIconConverter : BaseValueConverter<LidarWorkModeToAliIconConverter>
    {
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return DoConvert(value);
        }

        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        private object DoConvert(object value) 
        {
            var icon = "\ue88b";

            if (Enum.TryParse(value.ToString(), out LidarWorkMode lidarWork))
            {
                switch (lidarWork)
                {
                    case LidarWorkMode.Fixed:
                        icon = "\ue611";
                        break;
                    case LidarWorkMode.Horizontal:
                        icon = "\ue708";
                        break;
                    case LidarWorkMode.Vertical:
                        icon = "\ue646";
                        break;
                    case LidarWorkMode.Underway:
                        icon = "\ue61b";
                        break;
                    case LidarWorkMode.Multi:
                        icon = "\uea6f";
                        break;
                    default:
                        break;
                }
            }

            return icon;
        }

      
    }
}
